package text;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class text1 {

	// 201521145048
	public static void convertGBK2UTF8(String src, String dst)
			throws IOException {
		BufferedReader bufferedReader = new BufferedReader(new FileReader(src));
		String lineString = null;
		OutputStreamWriter outputStreamWriter = new OutputStreamWriter(
				new FileOutputStream(dst), "UTF-8");
		while ((lineString = bufferedReader.readLine()) != null) {
			outputStreamWriter.write(lineString + "\n");
		}
		bufferedReader.close();
		outputStreamWriter.close();
	}

	public static void main(String[] args) throws IOException {

		// 201521145048
		String fileName = "EncodeTest.txt";
		BufferedReader bf = null;

		FileInputStream fileInputStream = new FileInputStream(fileName);
		InputStreamReader inputStreamReader = new InputStreamReader(
				fileInputStream, "UTF-8");
		bf=new BufferedReader(inputStreamReader);
		String line = null;
		while ((line = bf.readLine()) != null) {
			System.out.println(line);
		}
		bf.close(); 

	}

}
